package net.cn_su.sharpeyes.adapter;

import android.content.Context;

import net.cn_su.sharpeyes.R;
import net.cn_su.sharpeyes.baseadapter.ViewHolder;
import net.cn_su.sharpeyes.baseadapter.recyleview.RVCommonAdapter;
import net.cn_su.sharpeyes.beans.DangerInfo;
import net.cn_su.sharpeyes.utils.DateTool;

import java.util.List;

/**
 * Created by Administrator on 2016/8/24.
 */
public class DangerAdapter extends RVCommonAdapter<DangerInfo> {


    public DangerAdapter(Context context, int layoutId, List<DangerInfo> datas) {
        super(context, layoutId, datas);
    }

    @Override
    public void convert(ViewHolder holder, DangerInfo dangerInfo, int position) {

        holder.setTextViewText(R.id.tv_time01, DateTool.timesToStrTime(dangerInfo.getCall_date_timestamp() + "", "yyyy年MM月dd日"))
                .setTextViewText(R.id.tv_camera, dangerInfo.getCamera())
                .setTextViewText(R.id.tv_address, dangerInfo.getOrganization())
                .setTextViewText(R.id.tv_type, dangerInfo.getCall_type())
        ;


        switch (dangerInfo.getCall_type()) {
            case "火警":

                holder.setImageByResource(R.id.iv_type, R.drawable.icon_call_fire);
                break;
            case "伤害":
                holder.setImageByResource(R.id.iv_type, R.drawable.icon_call_hurt);
                break;
            case "盗窃":
                holder.setImageByResource(R.id.iv_type, R.drawable.icon_call_steal);
                break;
            case "其他":
                holder.setImageByResource(R.id.iv_type, R.drawable.icon_call_other);
                break;
        }
    }
}
